import { Observable,interval } from 'rxjs';
import { take,tap } from 'rxjs/operators'
//tap 窃听
console.log(Date.now());
const observable:Observable<any> = interval(1000);
const observableTake:Observable<any> = observable.pipe(take(5));
const observableTimer:Observable<any> = observableTake.pipe(tap(
  {
    next:(value:any) => {
      console.log('[tap]###next###');
      console.log(Date.now());
      console.log(typeof(value));
      console.log(value);
    },
    complete:() => {
      console.log('[tap]###complete###');
    },
    error:(error:any) => {
      console.log('[tap]###error###');
      console.log(error);
    }
  }
));

observableTimer.subscribe(
  {
    next:(value:any) => {
      console.log('[1]###next###');
      console.log(Date.now());
      console.log(typeof(value));
      console.log(value);
    },
    complete:() => {
      console.log('[1]###complete###');
    },
    error:(error:any) => {
      console.log('[1]###error###');
      console.log(error);
    }
  }
);